//运行时 chunk 要在所有入口前加载呢？
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
    mode: "development",
    context: path.resolve(__dirname, 'src'),  //基础目录
    entry: {
        app: {
            // dependOn: 'runtime',  //runtime 和 dependOn 为什么不能同时使用？
            import: './index.js',
            runtime: 'runtime'
        },  //如果这里传 ./src/index.js ，webpack 内部的 context 会被认为是 src 目录吗？
        index: {
            import: ['./index1.js', './index2.js'],
            runtime: 'runtime'
        }
    },
    output: {
        path: path.resolve(__dirname, 'dist'),
        // publicPath: 'js',
        chunkFilename: "[name].[chunkhash].js" 
    },
    plugins: [
        new HtmlWebpackPlugin({
            title: 'Development'
        })
    ],
    watch: false,
    devServer: {
        static: {
            directory: path.resolve(__dirname, './dist')
        },
        compress: true,
        port: 9000,
        liveReload: false
    }
}